//
//  SACollectionPayCell.m
//  saasRetail
//
//  Created by mac on 2022/11/20.
//

#import "SACollectionPayCell.h"
#import "SAPayTypeModel.h"

@interface SACollectionPayCell ()

@property (nonatomic, strong) UIImageView *iconImageV;
@property (nonatomic, strong) UILabel *iconNameLab;
@property (nonatomic, strong) UIView *pinkView;

@end

@implementation SACollectionPayCell
-(instancetype)initWithFrame:(CGRect)frame {
    if(self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

-(void)setModel:(SAPayTypeModel *)model {
    _model = model;
    self.iconImageV.image = [UIImage imageNamed:model.payTypeIcon];
    self.iconNameLab.text = model.payTypeName;
    self.pinkView.hidden = !model.isSelect;
}

#pragma mark - initUI
-(void)initUI {
    [self.contentView addSubview:self.iconImageV];
    [self.contentView addSubview:self.iconNameLab];
    self.contentView.userInteractionEnabled = YES;
    
    UIView *pinkView = [[UIView alloc] initWithFrame:CGRectMake(kScaleNum(5), 0, kScaleNum(50), kScaleNum(70))];
    pinkView.layer.borderWidth = kScaleNum(1);
    pinkView.layer.borderColor = kPinkColor.CGColor;
    pinkView.userInteractionEnabled = NO;
    [self.contentView addSubview:pinkView];
    self.pinkView = pinkView;
}

#pragma mark - lazy
-(UIImageView *)iconImageV {
    if (!_iconImageV) {
        _iconImageV = [[UIImageView alloc] initWithFrame:CGRectMake(kScaleNum(10), kScaleNum(5), kScaleNum(40), kScaleNum(40))];
    }
    return _iconImageV;
}

-(UILabel *)iconNameLab {
    if (!_iconNameLab) {
        _iconNameLab = [[UILabel alloc] initWithFrame:CGRectMake(0, kScaleNum(45), kScaleNum(60), kScaleNum(20))];
        _iconNameLab.textColor = kBlackColor;
        _iconNameLab.textAlignment = NSTextAlignmentCenter;
        _iconNameLab.font = kFont(13);
    }
    return _iconNameLab;
}

@end

